#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 110;
const int mod = 998244353;

int a[N],b[N],t[N],tot,n;
ll inv[N],C[N],g[N],pro = 1;

int pos(int x){return lower_bound(t + 1,t + tot + 1,x) - t;}

ll qp(ll x,int t){ll res=1;for(;t;t >>= 1,x = x * x % mod) if(t & 1) res = res * x % mod;return res;}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in;
	for(int i = 1;i <= n;i++) a[i] = in,b[i] = in,t[++tot] = a[i],t[++tot] = b[i] + 1,pro = pro * (b[i] - a[i] + 1) % mod;
	sort(t + 1,t + tot + 1); tot = unique(t + 1,t + tot + 1) - t - 1;
	for(int i = 1;i <= n;i++) a[i] = pos(a[i]),b[i] = pos(b[i] + 1);
	inv[1] = 1; for(int i = 2;i <= n;i++) inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	C[0] = 1; g[0] = 1;
	for(int i = tot - 1;i >= 1;i--){
		int len = t[i + 1] - t[i];
		for(int j = 1;j <= n;j++) C[j] = C[j-1] * (len + j - 1) % mod * inv[j] % mod;
		for(int j = n;j > 0;j--){
			if(a[j] <= i && b[j] >= i + 1){
				ll f = 0; int m = 1;
				for(int p = j - 1;p >= 0;p--){
					f = (f + g[p] * C[m] % mod) % mod;
					if(a[p] <= i && b[p] >= i + 1) m++;
					else break;
				}
				g[j] = (g[j] + f) % mod;
			}
		}
	}
	ll ans = g[n];
	printf("%lld\n",ans * qp(pro,mod-2) % mod);
	return 0;
}

